import Taro ,{ Component } from '@tarojs/taro';
import { View , Text , Image  } from '@tarojs/components';
import { baseImgSrc , baseUrl } from '../../util/util.js';
import { getUserInfo , upServerFile , setHeading } from '../../util/api'
import { AtList, AtListItem } from "taro-ui";
import './userinfo.scss';

class UserinfoModule extends Component{
    constructor(){
        super(...arguments);
        this.state = {
            userInfo:{},
            value:"",
        }
    }
    config = {
        navigationBarTitleText:"个人资料",
    }
    componentWillMount(){
        getUserInfo().then(res => {
            if(res.code == 0){
                this.setState({userInfo:res.data})
            }
        })
    }
    render(){
        const { userInfo } = this.state;
        return(
            <View className='userinfo'>
                <AtList>
                    <AtListItem
                        title=''
                        arrow='right'
                        thumb={userInfo.headimg}
                    />
                    <AtListItem title='昵称'  extraText={userInfo.nickname} />
                    <AtListItem title='注册时间'  extraText={userInfo.add_time} hasBorder={false} />
                </AtList>
            </View>
        )
    }   
}
export default UserinfoModule

